import {store} from '../index'
import {defineStore} from 'pinia'

type Equipment = { equipmentType: string; equipmentNo: string }

interface regState {
    deptId: NumUn
    equipmentVO: Equipment
}

export const useRegtStore = defineStore({
    id: 'reg',
    state: (): regState => {
        return {
            deptId: undefined, //科室id
            equipmentVO: {equipmentType: "", equipmentNo: ""} //设备List
        }
    },
    getters: {
        getDeptId(): NumUn {
            return this.deptId
        },
        getEquipmentVO(): Equipment {
            return this.equipmentVO
        }
    },
    actions: {
        setDeptId(deptId: NumUn) {
            this.deptId = deptId
        },
        setEquipmentVO(equipmentVO: Equipment) {
            this.equipmentVO = equipmentVO
        }
    }
})

export const useRegStoreWithOut = () => {
    return useRegtStore(store)
}
